﻿using Bmz.Studio.Core;
using Bmz.Studio.Services;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Bmz.Studio.Web.Controllers
{
    public class HomeController : Controller
    {
        private IPersonService _personService;
        private INavigationService _navigationService;
        private IDictionaryService _dictionaryService;

        public HomeController(IPersonService personService, INavigationService navigationService, IDictionaryService dictionaryService)
        {
            _personService = personService;
            _navigationService = navigationService;
            _dictionaryService = dictionaryService;
        }

        public ActionResult Index()
        {
            ViewBag.Title = ConfigurationManager.AppSettings["WebSite.Title"];
            ViewBag.WorkTypeList = _dictionaryService.GetListByType(ConstantStringes.WorkType);

            var personId = Convert.ToInt32(ConfigurationManager.AppSettings["Current.PersonId"]);
            var person = _personService.GetPerson(personId);
            return View(person);
        }

        public ActionResult Navbar()
        {
            ViewBag.Title = ConfigurationManager.AppSettings["WebSite.Title"];
            var Navs = _navigationService.GetAllNavigation();
            return View("Navbar", Navs);
        }
    }
}